package cn.fuxi2022.module.banner.controller;

import cn.fuxi2022.model.empty.applets.GroupBanner;
import cn.fuxi2022.model.resp.R;
import cn.fuxi2022.module.banner.service.GroupBannerService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user/banner")
public class BannerController {

    @Autowired
    private GroupBannerService groupBannerService;

    @GetMapping("/getList")
    public R getList() {
        LambdaQueryWrapper<GroupBanner> wrapper = new LambdaQueryWrapper<>();
        wrapper.orderByAsc(GroupBanner::getSort);
        wrapper.orderByDesc(GroupBanner::getGmtCreate);
        return R.ok().data(groupBannerService.list(wrapper));
    }
}
